/*
package com.qlyl.modules.information.controller;

import com.qlyl.common.api.vo.Result;
import com.qlyl.modules.information.service.IBannerService;
import com.qlyl.modules.information.service.INewsService;
import com.qlyl.modules.information.vo.BannerVo;
import com.qlyl.modules.information.vo.NewsVo;
import io.swagger.annotations.*;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

@RestController
@RequestMapping("/appapi/")
@Api(tags = "banner与新闻的API")
public class BannersAndNewsController {

    @Autowired
    private IBannerService iBannerService;

    @Autowired
    private INewsService iNewsService;

    @ApiOperation(value = "获取banner", notes = "获取banner集合，限制个数<limit>", httpMethod = "GET", response = Result.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "banner限制个数", value = "3", required = true, dataType = "long")
    })
    @GetMapping(value = {"banners", "banners/{limit:^[1-9]\\d*$}"})
    public Result getBanners(@PathVariable(value = "limit", required = false)
                             Long bannerLimit) {
        return iBannerService.getBannerList(bannerLimit == null ? 3 : bannerLimit);
    }

    @ApiOperation(value = "添加banner", notes = "添加banner", httpMethod = "POST", response = Result.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bannerVo实体类", required = true, dataType = "BannerVo")
    })
    @PostMapping("banners")
    public Result addBanner(@RequestBody(required = true) @Valid BannerVo bannerVo) {
        return iBannerService.addBanner(bannerVo);
    }

    @PostMapping("news")
    public Result addNews(@RequestBody(required = true) @Valid NewsVo newsVo) {
        iNewsService.addNews(newsVo);
        return Result.ok();
    }

    @GetMapping("news/{page:^[1-9]\\d*$}/{limit:^[1-9]\\d*$}")
    public Result getNewsByLimit(@PathVariable(value = "page") Long page, @PathVariable(value = "limit") Long limit) {
        long start = (page - 1) * limit;
        List<NewsVo> newsVos = iNewsService.getNewsList(start, limit);
        return Result.ok(newsVos);
    }

    @DeleteMapping("news/{id:^-[1-9]\\d*$}")
    public Result deleteNews(@PathVariable(value = "id") Long id) {
        long l = iNewsService.deleteNews(id);
        if (l > 0) return Result.ok("成功删除" + l + "项数据");
        return Result.error("删除失败");
    }
}
*/
